package com.blogSystem.typeDefine.listener;

import com.blogSystem.typeDefine.client.BaseClient;
import com.blogSystem.typeDefine.client.BaseClientA;
import entity.Result;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
@RabbitListener(queues = "article")
public class TypeListener {
    @Autowired
    private BaseClient baseClient;
    @Autowired
    private BaseClientA baseClientA;

    @RabbitHandler
    public void executeSms(Map<String,String> map){
        String text=map.get("text");
        String _id=map.get("_id");
       String type_id=baseClient.get_type(text);
       baseClientA.add_type(_id,type_id);
    }
}
